<template>
  <div class="mineFollow">
    <header>
      <div class="back">
        <van-icon name="arrow-left" size="22" color="black" @click="back" />
      </div>
      <div class="title">我的关注</div>
      <div></div>
    </header>
    <div class="follows" v-if="follows.length > 0">
      <MineFollowItem
        v-for="follow in follows"
        :key="follow"
        :followId="follow"
      />
    </div>
  </div>
</template>

<script>
import MineFollowItem from "@/components/MineFollowItem.vue";

export default {
  components: {
    MineFollowItem,
  },
  name: "MineFollow",
  data() {
    return {
      follows: [],
    };
  },
  created() {
    // console.log("activated");
    this.follows = JSON.parse(localStorage.getItem("follows") || "[]");
  },
  methods: {
    back() {
      window.history.go(-1);
    },
  },
  // destroyed() {
  //   console.log("destroyed");
  // },
};
</script>

<style lang="scss" scoped>
.mineFollow {
  padding-top: 50px;

  header {
    background-color: white;
    border-bottom: 1px solid #f2f2f2;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    height: 50px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;

    > div {
      width: 33%;
    }

    .back {
      i {
        margin-left: 15px;
      }
    }

    .title {
      font-size: 20px;
      font-weight: bold;
      text-align: center;
    }
  }
}
</style>
